package cn.gcjxsc.service.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * @author pumbaa
 * @since 1.0
 */
@Service
public class SysConfigService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 查询会员可注册的店铺业务员数量.
     *
     * @return 返回数量, 默认为5家店铺
     */
    public long queryMaxStoreCountForMemberSalesman() {
        String sql = "select value from rw_integral_setting where name = memberSalesmanCount";
        try {
            return jdbcTemplate.queryForObject(sql, Long.class);
        } catch (DataAccessException e) {
            return 5;
        }
    }
}
